<template>
  <div class="app-upload">
    <div class="ios" v-if="show" @click.stop="appDown">
      <!-- <img
        class="img1"
        @click.stop="appDown"
        v-if="show"
        src="../../static/img/app-ios.png"
      /> -->
      <img class="img2" src="../../static/img/ios-ewm.png" />
    </div>
    <div class="an" @click="appDown_" v-else>
      <!-- <img class="img1" @click="appDown_" src="../../static/img/app-an.png" /> -->
      <img class="img2" src="../../static/img/an-ewm.png" />
    </div>
  </div>
</template>
<script>
export default {
  name: "",
  data() {
    return {
      show: true,
    };
  },
  created() {
    document.title = "app下载";
    this.appDown();
  },
  methods: {
    appDown() {
      var u = navigator.userAgent;
      var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
      var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android终端
      if (isiOS) {
        this.show = true;
        window.location.href = "https://itunes.apple.com/cn/app/id1469846769";
      } else if (isAndroid) {
        this.show = false;
        window.location.href =
          "https://appgallery.huawei.com/#/app/C100898367?sharePrepath=ag&locale=zh_CN&source=appshare&subsource=C100898367&shareTo=weixin&shareFrom=appmarket";
      }
    },
    appDown_() {
      window.location.href =
        "https://appgallery.huawei.com/#/app/C100898367?sharePrepath=ag&locale=zh_CN&source=appshare&subsource=C100898367&shareTo=weixin&shareFrom=appmarket";
    },
  },
};
</script>
<style lang="less">
.app-upload {
  width: 100%;
  .ios {
    width: 100%;
    height: 100vh;
    position: relative;
    background-image: url("/static/img/app-ios.png");
    background-repeat: no-repeat;
    // background-size: cover;
    // background-position: 50%;
    background-size: cover;
    -webkit-background-size: cover;
    -o-background-size: cover;
    background-position: center 0;
    .img2 {
      position: fixed;
      width: 100%;
      left: 0;
      bottom: 50px;
    }
  }
  .an {
    width: 100%;
    height: 100vh;
    position: relative;
    background-image: url("/static/img/app-an.png");
    background-repeat: no-repeat;
    // background-size: cover;
    // background-position: 50%;
    background-size: cover;
    -webkit-background-size: cover;
    -o-background-size: cover;
    background-position: center 0;
    .img2 {
      position: fixed;
      width: 100%;
      left: 0;
      bottom: 50px;
    }
  }
}
</style>